﻿#include "ssCameraSystem.h"
#include "../node/ssNode.h"
#include "../element/camera/ssThirdPersonCamera.h"


namespace StarSeeker
{

	ssCameraSystem::ssCameraSystem()
	{
		m_compType.Insert(ssComponent::ComponentType_e::SS_COMPONENT_CAMERA);
	}

	void ssCameraSystem::Work()
	{
		ssCamera* pCamera = 0;
		for (u32 i = 0; i < m_nodes.Count(); ++i)
		{
			pCamera = SS_DYNAMIC_CAST(ssCamera*, m_nodes[i]->GetComponent(ssComponent::SS_COMPONENT_CAMERA));
			if (pCamera->IsType(CAMERA_TYPE_TP))
			{
				ssThirdPersonCamera* ptp = SS_DYNAMIC_CAST(ssThirdPersonCamera*, pCamera);
				if (ptp->hasDirty())
				{
					ptp->SetViewMatrix();
				}
			}
		}
	}

}
